package light.head.model.el;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;
/**
 * 班级课程
 */
@Table
@Entity
@IdClass(ClassesCourseRelationPK.class)
public class ClassesCourseRelation implements Serializable{
	
	
	private static final long serialVersionUID = -7968968529074967094L;
	
	
	private Integer cc;				// 课程编号
	private Integer clc;			// 班级编号
	private Integer ttc;			// 模板编号
/*	private Date startExamTime;		// 考试开始时间
	private Date endExamTime;		// 考试结束时间
*/	private Integer examTime;		// 考试时间
	private Short num;				// 考试次数
	private Float qualifiedSocre;	// 合格分数
	private Integer time;			// 提醒时间
	private Integer tc;				// 讲师编号
	private Byte type;				// 考试查看已考试卷的权限（1.能看自己填写的答案2.能看自己选的和正确答案）
	private Double passRate = 0.0;	// 及格率
	private Double LearnRate = 0.0;	// 学习时长率
	
	private List<ExamRecord> list;	// 考试记录
	private List<Learn> learnList;	// 学习情况
	
	private ExamRecord bestEr;		// 学生该门课程 最好的成绩
	//Formula属性
	private String ccn;				// 课程名称
	private String tn;				// 讲师名称
	private Float total;			// 试卷总分

	
	@Id
	@Column
	public Integer getCc() {
		return cc;
	}
	@Id
	@Column
	public Integer getClc() {
		return clc;
	}
	@Column
	public Integer getTtc() {
		return ttc;
	}
	@Column
	public Integer getExamTime() {
		return examTime;
	}
	@Column
	public Short getNum() {
		return num;
	}
	@Column
	public Float getQualifiedSocre() {
		return qualifiedSocre;
	}
	@Column
	public Integer getTime() {
		return time;
	}
	@Column
	public Byte getType() {
		return type;
	}
	@Column
	public Double getPassRate() {
		return passRate;
	}
	@Column
	public Double getLearnRate() {
		return LearnRate;
	}

	@Column
	public Integer getTc() {
		return tc;
	}
	@Formula("(SELECT c.name FROM Course c WHERE c.code = cc)")
	public String getCcn() {
		return ccn;
	}
	@Formula("(SELECT l.ln FROM Lecturer l WHERE l.code = tc)")
	public String getTn() {
		return tn;
	}
	@Formula("(IFNULL((SELECT tt.score FROM PaperTemplate tt WHERE tt.code = ttc), (SELECT SUM(cctr.points) FROM ClassCourseTopicRelation cctr WHERE cctr.clc = clc AND cctr.cc = cc)))")
	public Float getTotal() {
		return total;
	}
	@Transient
	public ExamRecord getBestEr() {
		return bestEr;
	}
	@Transient
	public List<ExamRecord> getList() {
		return list;
	}
	@Transient
	public List<Learn> getLearnList() {
		return learnList;
	}
	
	
	
	

	
	
	
	
	public void setLearnRate(Double learnRate) {
		LearnRate = learnRate;
	}
	public void setPassRate(Double passRate) {
		this.passRate = passRate;
	}
	public void setTc(Integer tc) {
		this.tc = tc;
	}
	public void setTn(String tn) {
		this.tn = tn;
	}
	public void setCc(Integer cc) {
		this.cc = cc;
	}
	public void setClc(Integer clc) {
		this.clc = clc;
	}
	public void setTtc(Integer ttc) {
		this.ttc = ttc;
	}
	public void setExamTime(Integer examTime) {
		this.examTime = examTime;
	}
	public void setNum(Short num) {
		this.num = num;
	}
	public void setQualifiedSocre(Float qualifiedSocre) {
		this.qualifiedSocre = qualifiedSocre;
	}
	public void setTotal(Float total) {
		this.total = total;
	}
	public void setCcn(String ccn) {
		this.ccn = ccn;
	}
	public void setBestEr(ExamRecord bestEr) {
		this.bestEr = bestEr;
	}
	public void setList(List<ExamRecord> list) {
		this.list = list;
	}
	public void setLearnList(List<Learn> learnList) {
		this.learnList = learnList;
	}
	public void setTime(Integer time) {
		this.time = time;
	}
	public void setType(Byte type) {
		this.type = type;
	}
}
